package com.webcash.CNBoard.Model;

import java.util.Calendar;
import java.util.Date;

public class HistoryWithJobs implements Comparable{
	private int historyNo;
	private int projectNo;
	private int whereNo;
	private int jobNo;
	private Date writeDate;
	private Date modifyDate;
	private int workNo;
	private String workType;
	private String workTitle;
	private int docNo;
	private String docTitle;
	private int fileNo;
	private String fileName;
	private String filePath;
	
	public int getHistoryNo() {
		return historyNo;
	}
	public void setHistoryNo(int historyNo) {
		this.historyNo = historyNo;
	}
	public int getProjectNo() {
		return projectNo;
	}
	public void setProjectNo(int projectNo) {
		this.projectNo = projectNo;
	}
	public int getWhereNo() {
		return whereNo;
	}
	public void setWhereNo(int whereNo) {
		this.whereNo = whereNo;
	}
	public int getJobNo() {
		return jobNo;
	}
	public void setJobNo(int jobNo) {
		this.jobNo = jobNo;
	}
	public Date getWriteDate() {
		return writeDate;
	}
	public void setWriteDate(Date writeDate) {
		this.writeDate = writeDate;
	}
	public Date getModifyDate() {
		return modifyDate;
	}
	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}
	public int getWorkNo() {
		return workNo;
	}
	public void setWorkNo(int workNo) {
		this.workNo = workNo;
	}
	public String getWorkType() {
		return workType;
	}
	public void setWorkType(String workType) {
		this.workType = workType;
	}
	public String getWorkTitle() {
		return workTitle;
	}
	public void setWorkTitle(String workTitle) {
		this.workTitle = workTitle;
	}
	public int getDocNo() {
		return docNo;
	}
	public void setDocNo(int docNo) {
		this.docNo = docNo;
	}
	public String getDocTitle() {
		return docTitle;
	}
	public void setDocTitle(String docTitle) {
		this.docTitle = docTitle;
	}
	public int getFileNo() {
		return fileNo;
	}
	public void setFileNo(int fileNo) {
		this.fileNo = fileNo;
	}
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	@Override
	public String toString() {
		return "HistoryWithJobs [historyNo=" + historyNo + ", projectNo="
				+ projectNo + ", whereNo=" + whereNo + ", jobNo=" + jobNo
				+ ", writeDate=" + writeDate + ", modifyDate=" + modifyDate
				+ ", workNo=" + workNo + ", workType=" + workType
				+ ", workTitle=" + workTitle + ", docNo=" + docNo
				+ ", docTitle=" + docTitle + ", fileNo=" + fileNo
				+ ", fileName=" + fileName + ", filePath=" + filePath + "]";
	}
	public int compareTo(Object o) {
		HistoryWithJobs jobs = (HistoryWithJobs) o;
		
		
		Calendar cal = Calendar.getInstance();
		cal.setTime(writeDate);
		
		Calendar compareCal = Calendar.getInstance();
		compareCal.setTime(jobs.getWriteDate());
		
		
		System.out.println(cal.get(Calendar.HOUR_OF_DAY));
		System.out.println(cal.get(Calendar.HOUR));
		System.out.println(cal.get(Calendar.MINUTE));
		int result = (((cal.get(Calendar.YEAR) - compareCal.get(Calendar.YEAR)) * 365) + (cal
				.get(Calendar.DAY_OF_YEAR) - compareCal
				.get(Calendar.DAY_OF_YEAR)) * 100)
				+ (cal.get(Calendar.HOUR_OF_DAY) - compareCal
						.get(Calendar.HOUR_OF_DAY))
				+ (cal.get(Calendar.MINUTE) - compareCal.get(Calendar.MINUTE));
		return result * -1;
		
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	
	
}
